<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户昵称：</label>
                                <input type="text" name="userNickname"/>
                            </li>
                            <li>
                                <label>用户手机号：</label>
                                <input type="text" name="userPhone"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('lm:user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('lm:user:remove')}]];
        var prefix = ctx + "lm/user";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "用户",
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible:false
                },
                {
                    field: 'userNickname',
                    title: '用户昵称',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'userPic',
                    title: '用户头像',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'userPhone',
                    title: '用户手机号'
                },
                {
                    field: 'isServiceuser',
                    title: '是否认证服务商'
                },
                {
                    field: 'userImg',
                    title: '身份证正面'
                }]
            };
            $.table.init(options);
        });


        /* 添加用户-选择用户-提交 */
        function submitHandler(index, layero) {
            var id = $.table.selectFirstColumns();
            var userName = $.table.selectColumns("userNickname");
            if (id.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.close();
            parent.$('#userId').val(id.join());
            parent.$('#userName').val(userName.join());
        }
    </script>
</body>
</html>